#include <iostream>
#include <string>
#include <set>

using namespace std;

struct Point {
	int x, y;

	bool operator<(const Point& rhs) const {
		if(x == rhs.x) {
			return y < rhs.y;
		} else {
			return x < rhs.x;
		}
	}
};

int main()
{
	int n;
	set<Point> s;

	cin >> n;
	for(int i = 0; i < n; i++) {
		Point tmp;
		cin >> tmp.x >> tmp.y;

		s.insert(tmp);
	}
	for(set<Point>::iterator it = s.begin(); it != s.end(); it++) {
		cout << it->x << " " << it->y << endl;
	}

	return 0;
}
